package com.hyd.manage.service.impl;

import java.util.List;
import com.hyd.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hyd.manage.mapper.AbnormalMapper;
import com.hyd.manage.domain.Abnormal;
import com.hyd.manage.service.IAbnormalService;

/**
 * 异常药品Service业务层处理
 * 
 * @author hwb
 * @date 2025-02-21
 */
@Service
public class AbnormalServiceImpl implements IAbnormalService 
{
    @Autowired
    private AbnormalMapper abnormalMapper;

    /**
     * 查询异常药品
     * 
     * @param id 异常药品主键
     * @return 异常药品
     */
    @Override
    public Abnormal selectAbnormalById(Long id)
    {
        return abnormalMapper.selectAbnormalById(id);
    }

    /**
     * 查询异常药品列表
     * 
     * @param abnormal 异常药品
     * @return 异常药品
     */
    @Override
    public List<Abnormal> selectAbnormalList(Abnormal abnormal)
    {
        return abnormalMapper.selectAbnormalList(abnormal);
    }

    /**
     * 新增异常药品
     * 
     * @param abnormal 异常药品
     * @return 结果
     */
    @Override
    public int insertAbnormal(Abnormal abnormal)
    {
        abnormal.setCreateTime(DateUtils.getNowDate());
        return abnormalMapper.insertAbnormal(abnormal);
    }

    /**
     * 修改异常药品
     * 
     * @param abnormal 异常药品
     * @return 结果
     */
    @Override
    public int updateAbnormal(Abnormal abnormal)
    {
        abnormal.setUpdateTime(DateUtils.getNowDate());
        return abnormalMapper.updateAbnormal(abnormal);
    }

    /**
     * 批量删除异常药品
     * 
     * @param ids 需要删除的异常药品主键
     * @return 结果
     */
    @Override
    public int deleteAbnormalByIds(Long[] ids)
    {
        return abnormalMapper.deleteAbnormalByIds(ids);
    }

    /**
     * 删除异常药品信息
     * 
     * @param id 异常药品主键
     * @return 结果
     */
    @Override
    public int deleteAbnormalById(Long id)
    {
        return abnormalMapper.deleteAbnormalById(id);
    }
}
